/**
 * @summary 文章请求模块
*/
import req from '@/utils/request';
import * as URL from '@/constants/api'

export function getArticleList(id) {
  return req({
    url: URL.ARTICLE_LIST,
    params: {
      channel_id: id,
      timestamp: Date.now(),
    }
  })
    .then(res => res.data.data.results)
    .catch(() => null);
}

export function getDetailsList(id) {
  return req({
    url: URL.DETAILS_PAGE + "/" + id,
    params: {
      article_id: id,
    }
  })
    .then(res => res.data.data)
    .catch(() => []);
}
export function getCommentsList(id) {
  return req({
    url: URL.COMMENTS,
    params: {
      type: 'a',
      source: id,
    }
  })
    .then(res => res.data.data.results)
    .catch(() => []);
}
